package com.chunlei.check.controller;

import com.chunlei.check.annotation.ApiIdempotent;
import com.chunlei.check.bean.User;
import com.chunlei.check.interceptor.Page;
import com.chunlei.check.service.TokenService;
import com.chunlei.check.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2020/11/9 19:48
 */
@RestController
public class TestController
{
    @Autowired
    TokenService tokenService;
    @Autowired
    private UserService userService;

    @GetMapping("/index")
    @ApiIdempotent
    public String index()
    {
        return "hello";
    }

    @GetMapping("/create")
    public String createToken()
    {
        return tokenService.createToken();
    }

    @GetMapping("/")
    public List<User> queryAll(String id, Page page)
    {
        return userService.queryAll(id, page);
    }
}
